package bargain.server.dao;

import bargain.enitity.Account;
import org.apache.ibatis.annotations.Update;

/**
 * @ClassName AccountDao
 * @Description
 * @Author Jingxiao.Ye
 * @Date 2022/1/4 下午10:04
 * @Version V1.0
 * @Since JDK 11
 */
public interface AccountDao {

    @Update("update `study`.`t_account` set dollar = dollar - #{dollar} where id = #{id} and dollar - #{dollar} >= 0")
    int reduceDollar(Account account);

    @Update("update `study`.`t_account` set dollar = dollar + #{dollar} where id = #{id} and dollar + #{dollar} >= 0")
    int addDollar(Account account);

    @Update("update `study`.`t_account` set rmb = rmb + #{rmb} where id = #{id} and rmb + #{rmb} >= 0")
    int addRmb(Account account);
}
